<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>获取时分秒毫秒</title>
</head>
<body>
    <script>
        //获取当前日期
        var date = new Date();
        //获取小时
        var hour = date.getHours();
        console.log(hour);
        //获取分钟
        var minute = date.getMinutes()
        console.log(minute);
        //获取秒
        var second = date.getSeconds();
        console.log(second);
        //获取毫秒
        var millisecond = date.getMilliseconds();
        console.log(millisecond);
    </script>
</body>
</html>